#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：1.获取json数据并转为字典.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-20 15:51
'''
import json
import requests

url = "http://www.cninfo.com.cn/new/hisAnnouncement/query"

# 先将apu需要的数据打包成字典发送过去
form_data = {
    'pageNum': '1',
    'pageSize': '30',
    'column': 'szse',
    'tabName': 'fulltext',
    'plate': 'sz',
    'stock': '',
    'searchkey': '',
    'secid': '',
    'category': '',
    'trade': '',
    'seDate': '2024-05-20~2024-11-21',
    'sortName': '',
    'sortType': '',
    'isHLtitle': 'true',
}

cookies = {
    'JSESSIONID': '89BC1CBB6432CA56C5E4EC44CC1AEF32',
    'SF_cookie_4': '40016378',
    'insert_cookie': '45380249',
    '_sp_ses.2141': '*',
    'routeId': '.uc2',
    '_sp_id.2141': '476ec87a-70e1-4233-8c43-b66dcc97f8a8.1732089146.1.1732089281.1732089146.ac938224-4a9a-4181-a748-864c37a59ec9',
}

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0',
}

# response = requests.post(url, data=form_data, headers=headers).content.decode()
# json_dict = json.loads(response)
# print(type(json_dict))
# print(json_dict)


response = requests.post(url, data=form_data, headers=headers).json()
print(type(response))
print(response)


